<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>CMS信息表</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" type="image/png" href="/resources/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="/resources/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <script src="/resources/js/echarts.min.js"></script>
    <link rel="stylesheet" href="/resources/css/amazeui.min.css"/>
    <link rel="stylesheet" href="/resources/css/amazeui.datatables.min.css"/>
    <link rel="stylesheet" href="/resources/css/app.css">
    <script src="/resources/js/jquery.min.js"></script>
    <!--富文本编辑器-->
    <link href="/resources/UEditor2/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="/resources/UEditor2/third-party/jquery.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/resources/UEditor2/umeditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/resources/UEditor2/umeditor.min.js"></script>
    <script type="text/javascript" src="/resources/UEditor2/lang/zh-cn/zh-cn.js"></script>

</head>

<body data-type="widgets">
<script src="/resources/js/theme.js"></script>
<div class="am-g tpl-g">
    <%--头部开始--%>
    <%@include file="header.jsp" %>
    <%--头部结束--%>

    <!-- 内容区域 -->
    <div class="tpl-content-wrapper" >

        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">

                        <%--信息--%>
                        <div class="container-fluid am-cf">
                            <div class="row">
                                <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                                    <div class="page-header-heading"><span class="am-icon-male page-header-heading-icon"></span> 新闻信息管理
                                        <small>Employee information management</small>
                                    </div>
                                    <p class="page-header-description">对新闻信息进行查看、修改、删除、等操作。</p>
                                </div>
                                <div class="am-u-lg-3 tpl-index-settings-button">
                                    <%--<button type="button" class="page-header-button"><span class="am-icon-paint-brush"></span> 设置</button>--%>
                                </div>
                            </div>
                        </div>

                        <div class="widget-head am-cf">
                            <div class="widget-title am-fl"> 新闻管理</div>
                            <div class="widget-function am-fr">
                                <a href="javascript:;" class="am-icon-cog"></a>
                            </div>
                        </div>

                        <div class="widget-body am-fr">

                            <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black">
                                <thead>
                                <tr>
                                    <th class="am-text-center">新闻标题</th>
                                    <th class="am-text-center">作者</th>
                                    <th class="am-text-center">发布时间</th>
                                    <th class="am-text-center">操作</th>
                                </tr>
                                </thead>
                                <tbody class="am-text-center">
                                <c:forEach items="${pageInfo.list }" var="cms">
                                    <tr>
                                        <td class="am-lg-text-left">
                                            <%--<c:choose>--%>
                                                <%--<c:when test="${cms.cmsInfo.title.lenght < 25}">${cms.cmsInfo.title}</c:when>--%>
                                                <%--<c:when test="${cms.cmsInfo.title.size() > 25 }">${fn:substring(cms.cmsInfo.title, 0, 25)}</c:when>--%>
                                            <%--</c:choose>--%>
                                            <c:if test="${pageInfo.list.size() < 10}">
                                                ${cms.cmsInfo.title}
                                            </c:if>
                                            <c:if test="${pageInfo.list.size() >= 10}">
                                                ${fn:substring(cms.cmsInfo.title, 0, 10)}....
                                            </c:if>

                                        </td>
                                        <td>
                                            ${cms.employee.loginName}
                                        </td>
                                        <td>${fn:substring(cms.cmsInfo.relsDate, 0, 10)}</td>
                                        <td>
                                            <button type="button" class="am-btn am-btn-xs am-btn-success"
                                                    onclick="window.location.href='/cmsController/showCmsInfoOne?id=' + ${cms.cmsInfo.id}"
                                                    data-am-modal="{target: '#addModel', width: 900}">
                                                <span class="am-icon-eye"></span> 查看
                                            </button>
                                            <button type="button" class="am-btn am-btn-xs am-btn-secondary"
                                                    onclick=" window.location.href = '/cmsController/showCmsInfoOneEdit?id='+ ${cms.cmsInfo.id}">
                                                <span class="am-icon-eye"></span> 编辑
                                            </button>
                                            <button type="button" class="am-btn am-btn-xs am-btn-danger"
                                                    onclick="delFun('${cms.cmsInfo.id}')"
                                                <%--data-am-modal="{target: '#delEmpConfirm'}"--%>>
                                                <span class="am-icon-trash-o"></span> 删除
                                            </button>
                                        </td>
                                    </tr>
                                </c:forEach>
                                <!-- more data -->
                                </tbody>
                            </table>

                            <!-- 分页开始 -->
                            <div class="am-u-lg-12 am-cf">

                                <!-- 分页文字信息，其中分页信息都封装在pageInfo中 -->
                                <div class="col-md-6">
                                    当前第：${pageInfo.pageNum }页，总共：${pageInfo.pages }页，总共：${pageInfo.total }条记录
                                </div>
                                <div class="am-fr">
                                    <ul class="am-pagination tpl-pagination">
                                        <!-- 首页 -->
                                        <li><a href="/cmsController/showCmsInfoPage?pn=1">首页</a></li>
                                        <!-- 上一页 -->
                                        <c:if test="${pageInfo.hasPreviousPage }">
                                            <li>
                                                <a href="/cmsController/showCmsInfoPage?pn=${pageInfo.pageNum-1 }" aria-label="Previous">
                                                    <span aria-hidden="true">&laquo;</span>
                                                </a>
                                            </li>
                                        </c:if>
                                        <!-- 循环遍历连续显示的页面，若是当前页就高亮显示，并且没有链接 -->
                                        <c:forEach items="${pageInfo.navigatepageNums }" var="page_Num">
                                            <c:if test="${page_Num == pageInfo.pageNum }">
                                                <li class="am-active"><a href="/cmsController/showCmsInfoPage?pn=${page_Num }">${page_Num }</a></li>
                                            </c:if>
                                            <c:if test="${page_Num != pageInfo.pageNum }">
                                                <li><a href="/cmsController/showCmsInfoPage?pn=${page_Num }">${page_Num }</a></li>
                                            </c:if>
                                        </c:forEach>
                                        <!-- 下一页 -->
                                        <c:if test="${pageInfo.hasNextPage }">
                                            <li>
                                                <a href="/cmsController/showCmsInfoPage?pn=${pageInfo.pageNum+1 }" aria-label="Next">
                                                    <span aria-hidden="true">&raquo;</span>
                                                </a>
                                            </li>
                                        </c:if>
                                        <!-- 末页 -->
                                        <li><a href="/cmsController/showCmsInfoPage?pn=${pageInfo.pages }">末页</a></li>
                                    </ul>
                                </div>
                            </div>
                            <!-- 分页结束 -->

                                <div class="am-form-group"></div>
                                <div class="am-form-group"></div>
                                <div class="am-form-group"></div>
                                <div class="am-form-group"></div>
                                <div class="am-form-group"></div>
                                <div class="am-form-group"></div>

                        </div>

                    </div>

                </div>

            </div>

        </div>
    </div>

        <!-- 删除信息提示警告框开始 -->
        <div class="am-modal am-modal-confirm" tabindex="-1" id="delEmpConfirm">
            <div class="am-modal-dialog">
                <div class="am-modal-hd">删除警告</div>
                <div class="am-modal-bd">
                    您，确定要删除这条记录吗？
                </div>
                <div class="am-modal-footer">
                    <span class="am-modal-btn" data-am-modal-cancel>取消</span>
                    <span class="am-modal-btn" data-am-modal-confirm>确定</span>
                </div>
            </div>
        </div>
        <!-- 删除信息提示警告框结束 -->
<script src="/resources/js/amazeui.min.js"></script>
<script src="/resources/js/amazeui.datatables.min.js"></script>
<script src="/resources/js/dataTables.responsive.min.js"></script>
<script src="/resources/js/app.js"></script>
    <script src="/resources/js/cmsInfo.form.validation.js"></script>

</body>

</html>